package com.qiqu.service.impl;

import com.qiqu.entity.SearchRecords;
import com.qiqu.dao.SearchRecordsDao;
import com.qiqu.service.SearchRecordsService;
import org.n3r.idworker.Sid;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service("searchRecordsService")
public class SearchRecordsServiceImpl implements SearchRecordsService {
    @Resource
    private SearchRecordsDao searchRecordsDao;
    @Resource
    private Sid sid;

    @Override
    public SearchRecords insert(SearchRecords searchRecords) {
        return null;
    }

    @Override
    public boolean deleteById(String id) {
        return false;
    }

    @Override
    public List<String> queryKeywords() {
        return searchRecordsDao.queryKeywords();
    }

    @Override
    public boolean addSearchRecords(SearchRecords searchRecord) {
        searchRecord.setId(sid.nextShort());
        return searchRecordsDao.insert(searchRecord)>0;
    }

    @Override
    public List<String> queryLikeKeywords(String userId) {
        return searchRecordsDao.queryLikeKeywords(userId);
    }
}